<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .box1 {
        width: 300px;
        height: 200px;
        border: 1px solid black;
        border-radius: 15px;
        background-color: aquamarine;
    }
    
    .p1 {
        width: 20px;
        height: 20px;
        text-align: center;
        background-color: white;
    }
</style>

<body>
    <div class="box1">
        <p class="p1">X</p>
    </div>
</body>

</html>
<script>
    var box1 = document.getElementsByClassName("box1")[0]
    var p1 = document.getElementsByClassName("p1")[0]
    p1.onclick = function() {
        box1.style.display = "none"
        setTimeout(function() {
            box1.style.display = "block"
        }, 2000)
    }
</script>